home *** CD-ROM | disk | FTP | other *** search
- // Fractal de JULIA.
-
- #include <dos.h>
- #include <conio.h>
- #include <stdio.h>
-
- #define NPH 320
- #define NPV 200
-
- void punto(int x,int y, int c)
- {
- pokeb(0xA000, (y*320)+x, (unsigned char) c);
- }
-
- int main(void)
- {
- float a,b;
- float x1=0;
- float x2=1;
- float y1=0;
- float y20,y2=1;
- float x,y,xx;
- float vanox,vanoy;
- int j,k,n;
-
- printf("Escribe los valores de 'a' y 'b'\n");
- scanf("\n%e",&a);
- scanf("\n%e",&b);
-
- //asm mov ax,0x13;
- //asm int 0x10;
-
- vanox=(x2-x1)/NPH;
- vanoy=(y2-y1)/NPV;
-
- for(k=0;k<NPH;k++)
- {
- x1+=vanox;
- y20=y2;
- for(j=0;j<NPV;j++)
- {
- y20+=vanoy; y=y20;
- x=x1; n=0;
- while(n<100 && x*x+y*y<100)
- {
- xx=x*x-y*y+a;
- y=2*x*y+b;
- x=xx; n++;
- printf("X=%f Y=%f\n",x,y);
- }
- if(x*x+y*y>100) punto(k,j,n);
- }
- }
- asm mov ax,0x93;
- asm int 0x10;
- while(!kbhit);
-
- asm mov ax,3;
- asm int 0x10;
- return 0;
- }